Reindented to use the GNOME Indentation.
authorFederico Mena Quintero <federico@redhat.com>
Mon, 18 Oct 1999 19:29:45 +0000 (19:29 +0000)
committerArturo Espinosa <unammx@src.gnome.org>
Mon, 18 Oct 1999 19:29:45 +0000 (19:29 +0000)
1999-10-18  Federico Mena Quintero  <federico@redhat.com>

* src/*: Reindented to use the GNOME Indentation.

16 files changed:
demos/testpixbuf.c
gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-cache.h
gdk-pixbuf/gdk-pixbuf-data.c
gdk-pixbuf/gdk-pixbuf-drawable.h
gdk-pixbuf/gdk-pixbuf-io.c
gdk-pixbuf/gdk-pixbuf.c
gdk-pixbuf/gdk-pixbuf.h
gdk-pixbuf/io-bmp.c
gdk-pixbuf/io-gif.c
gdk-pixbuf/io-jpeg.c
gdk-pixbuf/io-png.c
gdk-pixbuf/io-tiff.c
gdk-pixbuf/io-xpm.c
gdk-pixbuf/pixbuf.h [deleted file]
gdk/gdkpixbuf-drawable.c

index 297d2d2776ae60a8e5b5a3845f361c580820c408..e9b984ea16fe9076dfc496536b70c366d293671c 100644 (file)
 #define DEFAULT_HEIGHT 24
 
 static const unsigned char default_image[] = {
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xae, 0xb3, 0xb3, 0xc6, 0xc9, 0xcd, 0xd7, 0xd4, 0xdf,
-0xec, 0xde, 0xf3, 0xe7, 0xcb, 0xe9, 0xd9, 0xb5, 0xd3, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb1, 0xb7, 0xa5,
-0xb0, 0xb8, 0xad, 0xb3, 0xb9, 0xb6, 0xc1, 0xc6, 0xc8, 0xd5, 0xd3, 0xdc,
-0xec, 0xde, 0xf3, 0xe5, 0xca, 0xe6, 0xe0, 0xbb, 0xd7, 0xe1, 0xad, 0xc2,
-0xe3, 0xac, 0xa3, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xca, 0xc1, 0xa4, 0xc5, 0xc7, 0xac,
-0xb7, 0xbe, 0xaf, 0xad, 0xb4, 0xaf, 0xbd, 0xc2, 0xc3, 0xd1, 0xd0, 0xd8,
-0xec, 0xde, 0xf3, 0xe5, 0xc7, 0xe4, 0xe0, 0xb6, 0xd1, 0xe7, 0xa9, 0xb4,
-0xed, 0xcd, 0xb6, 0xd6, 0xcf, 0xae, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0x00, 0x00, 0x00, 0xdf, 0xa7, 0x9f, 0xdd, 0xbf, 0xaa, 0xcf, 0xc5, 0xa9,
-0xc1, 0xc4, 0xac, 0xb2, 0xba, 0xaf, 0xb6, 0xbb, 0xbb, 0xcd, 0xce, 0xd4,
-0xec, 0xde, 0xf3, 0xe4, 0xc4, 0xe1, 0xe0, 0xaf, 0xc7, 0xea, 0xbc, 0xae,
-0xe1, 0xd6, 0xb6, 0xc7, 0xcc, 0xae, 0xa2, 0xab, 0x9a, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0x00, 0x00, 0x00, 0xe3, 0xab, 0xc0, 0xe6, 0xa3, 0xa7, 0xdf, 0xba, 0xa8,
-0xcf, 0xc5, 0xa9, 0xbd, 0xc2, 0xae, 0xad, 0xb4, 0xaf, 0xc6, 0xc9, 0xcd,
-0xec, 0xde, 0xf3, 0xe2, 0xbf, 0xdc, 0xe7, 0xa9, 0xb4, 0xe7, 0xd6, 0xb8,
-0xc7, 0xcc, 0xae, 0xac, 0xb6, 0xa6, 0x9d, 0xa8, 0x9f, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0xd9, 0xaf, 0xcf, 0xe1, 0xb4, 0xd2, 0xe2, 0xb0, 0xcb, 0xe4, 0xa9, 0xbb,
-0xe2, 0xb2, 0xa6, 0xcf, 0xc5, 0xa9, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
-0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xed, 0xcd, 0xb6, 0xc7, 0xcc, 0xae,
-0xa6, 0xb1, 0xa3, 0x98, 0xa2, 0x9c, 0x8f, 0x97, 0x96, 0x7e, 0x84, 0x85,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0xe8, 0xc6, 0xe7, 0xe5, 0xc2, 0xe3, 0xe3, 0xbd, 0xdd, 0xe1, 0xb6, 0xd5,
-0xe2, 0xb0, 0xcb, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0x9d, 0xa8, 0x9f,
-0x8f, 0x97, 0x96, 0x8b, 0x90, 0x92, 0x97, 0x9e, 0xa2, 0xa0, 0xa7, 0xae,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0xe7, 0xd3, 0xed, 0xe8, 0xd1, 0xed, 0xe8, 0xce, 0xec, 0xe9, 0xcc, 0xeb,
-0xe8, 0xc6, 0xe7, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0x97, 0x9e, 0xa2,
-0xa7, 0xae, 0xb7, 0xb2, 0xb6, 0xc5, 0xba, 0xbc, 0xce, 0xbf, 0xbe, 0xd3,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0,
-0xe9, 0xdf, 0xf0, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0xe1, 0xd2, 0xf7,
-0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0xca, 0xc7, 0xd2, 0xc5, 0xc4, 0xcd, 0xbf, 0xbf, 0xc7, 0xb8, 0xb9, 0xc0,
-0xae, 0xaf, 0xb6, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0xd5, 0xa8, 0xe1,
-0xd8, 0xb2, 0xe9, 0xd9, 0xb8, 0xed, 0xdb, 0xbd, 0xf0, 0xdc, 0xbf, 0xf1,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0xa4, 0xa6, 0xac, 0xa8, 0xaa, 0xaf, 0xa0, 0xa6, 0xa8, 0x98, 0x9e, 0x9c,
-0xa1, 0xa8, 0x9e, 0xb1, 0xb6, 0xa1, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
-0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xc0, 0x8c, 0xad, 0xcc, 0x90, 0xb5,
-0xd3, 0x94, 0xca, 0xd6, 0xa2, 0xdb, 0xd5, 0xa8, 0xe1, 0xcf, 0xa7, 0xdf,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0x00, 0x00, 0x00, 0x98, 0x9f, 0x9b, 0xa1, 0xa8, 0x9e, 0xac, 0xb3, 0xa0,
-0xb9, 0xb9, 0xa4, 0xd0, 0xb8, 0xa8, 0xc5, 0xb5, 0xb8, 0xb6, 0xbb, 0xad,
-0xe3, 0xd7, 0xb5, 0xdd, 0xb4, 0xa9, 0xcb, 0x89, 0xac, 0xc0, 0x8c, 0xad,
-0xc8, 0x91, 0xb5, 0xd1, 0x8d, 0xb7, 0xd3, 0x94, 0xca, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0x00, 0x00, 0x00, 0xa1, 0xa7, 0x98, 0xb1, 0xb6, 0xa1, 0xbd, 0xb9, 0xa5,
-0xd0, 0xb8, 0xa8, 0xca, 0xb5, 0xb7, 0xb8, 0xb1, 0xb1, 0xc2, 0xc8, 0xb2,
-0xe3, 0xd7, 0xb5, 0xe1, 0xbf, 0xaf, 0xdb, 0x92, 0x9a, 0xbe, 0x82, 0xa6,
-0xc0, 0x8c, 0xad, 0xc8, 0x91, 0xb4, 0xc7, 0x8b, 0xb0, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbc, 0xb6, 0xa1, 0xd0, 0xb8, 0xa8,
-0xcd, 0xb6, 0xb7, 0xc0, 0xb4, 0xb5, 0xb1, 0xb1, 0xaa, 0xca, 0xd1, 0xb4,
-0xe3, 0xd7, 0xb5, 0xe2, 0xc1, 0xb0, 0xdb, 0xa8, 0xa3, 0xd2, 0x8a, 0xa9,
-0xb7, 0x7e, 0xa2, 0xbd, 0x89, 0xa9, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc9, 0xaf, 0xaf,
-0xc5, 0xb5, 0xb8, 0xb8, 0xb1, 0xb1, 0xb6, 0xbb, 0xad, 0xd0, 0xd6, 0xb5,
-0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xaf, 0xdd, 0xb4, 0xa9, 0xdb, 0x92, 0x9a,
-0xc6, 0x84, 0xa7, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xac, 0xaa, 0xa6, 0xbd, 0xc3, 0xb0, 0xd2, 0xd7, 0xb5,
-0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xae, 0xdb, 0xb6, 0xa8, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
-0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0xae, 0xb3, 0xb3, 0xc6, 0xc9, 0xcd, 0xd7, 0xd4, 0xdf,
+       0xec, 0xde, 0xf3, 0xe7, 0xcb, 0xe9, 0xd9, 0xb5, 0xd3, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb1, 0xb7, 0xa5,
+       0xb0, 0xb8, 0xad, 0xb3, 0xb9, 0xb6, 0xc1, 0xc6, 0xc8, 0xd5, 0xd3, 0xdc,
+       0xec, 0xde, 0xf3, 0xe5, 0xca, 0xe6, 0xe0, 0xbb, 0xd7, 0xe1, 0xad, 0xc2,
+       0xe3, 0xac, 0xa3, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xca, 0xc1, 0xa4, 0xc5, 0xc7, 0xac,
+       0xb7, 0xbe, 0xaf, 0xad, 0xb4, 0xaf, 0xbd, 0xc2, 0xc3, 0xd1, 0xd0, 0xd8,
+       0xec, 0xde, 0xf3, 0xe5, 0xc7, 0xe4, 0xe0, 0xb6, 0xd1, 0xe7, 0xa9, 0xb4,
+       0xed, 0xcd, 0xb6, 0xd6, 0xcf, 0xae, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0x00, 0x00, 0x00, 0xdf, 0xa7, 0x9f, 0xdd, 0xbf, 0xaa, 0xcf, 0xc5, 0xa9,
+       0xc1, 0xc4, 0xac, 0xb2, 0xba, 0xaf, 0xb6, 0xbb, 0xbb, 0xcd, 0xce, 0xd4,
+       0xec, 0xde, 0xf3, 0xe4, 0xc4, 0xe1, 0xe0, 0xaf, 0xc7, 0xea, 0xbc, 0xae,
+       0xe1, 0xd6, 0xb6, 0xc7, 0xcc, 0xae, 0xa2, 0xab, 0x9a, 0x00, 0x00, 0x00,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0x00, 0x00, 0x00, 0xe3, 0xab, 0xc0, 0xe6, 0xa3, 0xa7, 0xdf, 0xba, 0xa8,
+       0xcf, 0xc5, 0xa9, 0xbd, 0xc2, 0xae, 0xad, 0xb4, 0xaf, 0xc6, 0xc9, 0xcd,
+       0xec, 0xde, 0xf3, 0xe2, 0xbf, 0xdc, 0xe7, 0xa9, 0xb4, 0xe7, 0xd6, 0xb8,
+       0xc7, 0xcc, 0xae, 0xac, 0xb6, 0xa6, 0x9d, 0xa8, 0x9f, 0x00, 0x00, 0x00,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0xd9, 0xaf, 0xcf, 0xe1, 0xb4, 0xd2, 0xe2, 0xb0, 0xcb, 0xe4, 0xa9, 0xbb,
+       0xe2, 0xb2, 0xa6, 0xcf, 0xc5, 0xa9, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
+       0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xed, 0xcd, 0xb6, 0xc7, 0xcc, 0xae,
+       0xa6, 0xb1, 0xa3, 0x98, 0xa2, 0x9c, 0x8f, 0x97, 0x96, 0x7e, 0x84, 0x85,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0xe8, 0xc6, 0xe7, 0xe5, 0xc2, 0xe3, 0xe3, 0xbd, 0xdd, 0xe1, 0xb6, 0xd5,
+       0xe2, 0xb0, 0xcb, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0x9d, 0xa8, 0x9f,
+       0x8f, 0x97, 0x96, 0x8b, 0x90, 0x92, 0x97, 0x9e, 0xa2, 0xa0, 0xa7, 0xae,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0xe7, 0xd3, 0xed, 0xe8, 0xd1, 0xed, 0xe8, 0xce, 0xec, 0xe9, 0xcc, 0xeb,
+       0xe8, 0xc6, 0xe7, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0x97, 0x9e, 0xa2,
+       0xa7, 0xae, 0xb7, 0xb2, 0xb6, 0xc5, 0xba, 0xbc, 0xce, 0xbf, 0xbe, 0xd3,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0,
+       0xe9, 0xdf, 0xf0, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0xe1, 0xd2, 0xf7,
+       0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0xca, 0xc7, 0xd2, 0xc5, 0xc4, 0xcd, 0xbf, 0xbf, 0xc7, 0xb8, 0xb9, 0xc0,
+       0xae, 0xaf, 0xb6, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0xd5, 0xa8, 0xe1,
+       0xd8, 0xb2, 0xe9, 0xd9, 0xb8, 0xed, 0xdb, 0xbd, 0xf0, 0xdc, 0xbf, 0xf1,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0xa4, 0xa6, 0xac, 0xa8, 0xaa, 0xaf, 0xa0, 0xa6, 0xa8, 0x98, 0x9e, 0x9c,
+       0xa1, 0xa8, 0x9e, 0xb1, 0xb6, 0xa1, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
+       0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xc0, 0x8c, 0xad, 0xcc, 0x90, 0xb5,
+       0xd3, 0x94, 0xca, 0xd6, 0xa2, 0xdb, 0xd5, 0xa8, 0xe1, 0xcf, 0xa7, 0xdf,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0x00, 0x00, 0x00, 0x98, 0x9f, 0x9b, 0xa1, 0xa8, 0x9e, 0xac, 0xb3, 0xa0,
+       0xb9, 0xb9, 0xa4, 0xd0, 0xb8, 0xa8, 0xc5, 0xb5, 0xb8, 0xb6, 0xbb, 0xad,
+       0xe3, 0xd7, 0xb5, 0xdd, 0xb4, 0xa9, 0xcb, 0x89, 0xac, 0xc0, 0x8c, 0xad,
+       0xc8, 0x91, 0xb5, 0xd1, 0x8d, 0xb7, 0xd3, 0x94, 0xca, 0x00, 0x00, 0x00,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0x00, 0x00, 0x00, 0xa1, 0xa7, 0x98, 0xb1, 0xb6, 0xa1, 0xbd, 0xb9, 0xa5,
+       0xd0, 0xb8, 0xa8, 0xca, 0xb5, 0xb7, 0xb8, 0xb1, 0xb1, 0xc2, 0xc8, 0xb2,
+       0xe3, 0xd7, 0xb5, 0xe1, 0xbf, 0xaf, 0xdb, 0x92, 0x9a, 0xbe, 0x82, 0xa6,
+       0xc0, 0x8c, 0xad, 0xc8, 0x91, 0xb4, 0xc7, 0x8b, 0xb0, 0x00, 0x00, 0x00,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbc, 0xb6, 0xa1, 0xd0, 0xb8, 0xa8,
+       0xcd, 0xb6, 0xb7, 0xc0, 0xb4, 0xb5, 0xb1, 0xb1, 0xaa, 0xca, 0xd1, 0xb4,
+       0xe3, 0xd7, 0xb5, 0xe2, 0xc1, 0xb0, 0xdb, 0xa8, 0xa3, 0xd2, 0x8a, 0xa9,
+       0xb7, 0x7e, 0xa2, 0xbd, 0x89, 0xa9, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc9, 0xaf, 0xaf,
+       0xc5, 0xb5, 0xb8, 0xb8, 0xb1, 0xb1, 0xb6, 0xbb, 0xad, 0xd0, 0xd6, 0xb5,
+       0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xaf, 0xdd, 0xb4, 0xa9, 0xdb, 0x92, 0x9a,
+       0xc6, 0x84, 0xa7, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0xac, 0xaa, 0xa6, 0xbd, 0xc3, 0xb0, 0xd2, 0xd7, 0xb5,
+       0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xae, 0xdb, 0xb6, 0xa8, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
+       0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff
 };
 
-
-
 static void
 quit_func (GtkWidget *widget, gpointer dummy)
 {
-  gtk_main_quit ();
+       gtk_main_quit ();
 }
 
+static void
 expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
 {
-  GdkPixBuf *pixbuf;
-  gint x1, y1, x2, y2;
-
-  pixbuf = (GdkPixBuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
-
-  if (pixbuf->art_pixbuf->has_alpha){
-    gdk_draw_rgb_32_image (drawing_area->window,
-                          drawing_area->style->black_gc,
-                          event->area.x, event->area.y, 
-                          event->area.width, 
-                          event->area.height,
-                          GDK_RGB_DITHER_MAX, 
-                          pixbuf->art_pixbuf->pixels 
-                          + (event->area.y * pixbuf->art_pixbuf->rowstride) 
-                          + (event->area.x * pixbuf->art_pixbuf->n_channels),
-                          pixbuf->art_pixbuf->rowstride);
-  }else{
-    gdk_draw_rgb_image (drawing_area->window,
-                       drawing_area->style->white_gc,
-                       event->area.x, event->area.y, 
-                       event->area.width, 
-                       event->area.height,
-                       GDK_RGB_DITHER_NORMAL,
-                       pixbuf->art_pixbuf->pixels 
-                       + (event->area.y * pixbuf->art_pixbuf->rowstride) 
-                       + (event->area.x * pixbuf->art_pixbuf->n_channels),
-                       pixbuf->art_pixbuf->rowstride);
-  }
+       GdkPixbuf *pixbuf;
+       gint x1, y1, x2, y2;
+
+       pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
+
+       if (pixbuf->art_pixbuf->has_alpha) {
+               gdk_draw_rgb_32_image (drawing_area->window,
+                                      drawing_area->style->black_gc,
+                                      event->area.x, event->area.y, 
+                                      event->area.width, 
+                                      event->area.height,
+                                      GDK_RGB_DITHER_MAX, 
+                                      pixbuf->art_pixbuf->pixels 
+                                      + (event->area.y * pixbuf->art_pixbuf->rowstride) 
+                                      + (event->area.x * pixbuf->art_pixbuf->n_channels),
+                                      pixbuf->art_pixbuf->rowstride);
+       } else {
+               gdk_draw_rgb_image (drawing_area->window,
+                                   drawing_area->style->white_gc,
+                                   event->area.x, event->area.y, 
+                                   event->area.width, 
+                                   event->area.height,
+                                   GDK_RGB_DITHER_NORMAL,
+                                   pixbuf->art_pixbuf->pixels 
+                                   + (event->area.y * pixbuf->art_pixbuf->rowstride) 
+                                   + (event->area.x * pixbuf->art_pixbuf->n_channels),
+                                   pixbuf->art_pixbuf->rowstride);
+       }
 }  
 
+static void
 config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
 {
-    GdkPixBuf *pixbuf, *spb;
+       GdkPixbuf *pixbuf, *spb;
     
-    pixbuf = (GdkPixBuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
+       pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
 
-    g_print("X:%d Y:%d\n", event->width, event->height);
+       g_print("X:%d Y:%d\n", event->width, event->height);
 
-    if (((event->width) != (pixbuf->art_pixbuf->width)) ||
-       ((event->height) != (pixbuf->art_pixbuf->height))) 
-        gdk_pixbuf_scale(pixbuf, event->width, event->height);
+       if (((event->width) != (pixbuf->art_pixbuf->width)) ||
+           ((event->height) != (pixbuf->art_pixbuf->height))) 
+               gdk_pixbuf_scale(pixbuf, event->width, event->height);
 
 }
 
-void
-new_testrgb_window (GdkPixBuf *pixbuf)
+static void
+new_testrgb_window (GdkPixbuf *pixbuf)
 {
-  GtkWidget *window;
-  GtkWidget *vbox;
-  GtkWidget *button;
-  GtkWidget *drawing_area;
-  gint w, h;
+       GtkWidget *window;
+       GtkWidget *vbox;
+       GtkWidget *button;
+       GtkWidget *drawing_area;
+       gint w, h;
  
-  w = pixbuf->art_pixbuf->width;
-  h = pixbuf->art_pixbuf->height;
+       w = pixbuf->art_pixbuf->width;
+       h = pixbuf->art_pixbuf->height;
 
-  window = gtk_widget_new (gtk_window_get_type (),
-                          "GtkObject::user_data", NULL,
-                          "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
-                          "GtkWindow::title", "testrgb",
-                          "GtkWindow::allow_shrink", TRUE,
-                          NULL);
-  gtk_signal_connect (GTK_OBJECT (window), "destroy",
-                     (GtkSignalFunc) quit_func, NULL);
+       window = gtk_widget_new (gtk_window_get_type (),
+                                "GtkObject::user_data", NULL,
+                                "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
+                                "GtkWindow::title", "testrgb",
+                                "GtkWindow::allow_shrink", TRUE,
+                                NULL);
+       gtk_signal_connect (GTK_OBJECT (window), "destroy",
+                           (GtkSignalFunc) quit_func, NULL);
 
-  vbox = gtk_vbox_new (FALSE, 0);
+       vbox = gtk_vbox_new (FALSE, 0);
 
-  drawing_area = gtk_drawing_area_new ();
+       drawing_area = gtk_drawing_area_new ();
 
-  gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
-  gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
+       gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
+       gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
 
-  gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
-                     GTK_SIGNAL_FUNC(expose_func), NULL);
-  gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
-                     GTK_SIGNAL_FUNC (config_func), NULL);
+       gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
+                           GTK_SIGNAL_FUNC(expose_func), NULL);
+       gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
+                           GTK_SIGNAL_FUNC (config_func), NULL);
 
-  gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
+       gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
 
-  gtk_widget_show (drawing_area);
+       gtk_widget_show (drawing_area);
 
-  button = gtk_button_new_with_label ("Quit");
-  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
-                            (GtkSignalFunc) gtk_widget_destroy,
-                            GTK_OBJECT (window));
+       button = gtk_button_new_with_label ("Quit");
+       gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+       gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+                                  (GtkSignalFunc) gtk_widget_destroy,
+                                  GTK_OBJECT (window));
 
-  gtk_widget_show (button);
+       gtk_widget_show (button);
 
-  gtk_container_add (GTK_CONTAINER (window), vbox);
-  gtk_widget_show (vbox);
+       gtk_container_add (GTK_CONTAINER (window), vbox);
+       gtk_widget_show (vbox);
 
-  gtk_widget_show (window);
+       gtk_widget_show (window);
 }
 
 int
 main (int argc, char **argv)
 {
-  int i;
-  int found_valid = FALSE; 
-
-  GdkPixBuf *pixbuf;
-
-  gtk_init (&argc, &argv);
-
-  gdk_rgb_set_verbose (TRUE);
-
-  gdk_rgb_init ();
-
-  gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
-  gtk_widget_set_default_visual (gdk_rgb_get_visual ());
-
-  i = 1;
-  if (argc == 1)
-  {
-         pixbuf = gdk_pixbuf_load_image_from_rgb_d(default_image,
-                                                   DEFAULT_WIDTH,
-                                                   DEFAULT_HEIGHT);
-         if (pixbuf)
-         {
-                 new_testrgb_window (pixbuf);
-                 found_valid = TRUE;
-         }
-  } else {
-         for (i = 1; i < argc; i++)
-         {
-                 pixbuf = gdk_pixbuf_load_image (argv[i]);
-                 pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
+       int i;
+       int found_valid = FALSE; 
+
+       GdkPixbuf *pixbuf;
+
+       gtk_init (&argc, &argv);
+
+       gdk_rgb_set_verbose (TRUE);
+
+       gdk_rgb_init ();
+
+       gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
+       gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+
+       i = 1;
+       if (argc == 1) {
+               pixbuf = gdk_pixbuf_load_image_from_rgb_d(default_image,
+                                                         DEFAULT_WIDTH,
+                                                         DEFAULT_HEIGHT);
+               if (pixbuf) {
+                       new_testrgb_window (pixbuf);
+                       found_valid = TRUE;
+               }
+       } else {
+               for (i = 1; i < argc; i++) {
+                       pixbuf = gdk_pixbuf_load_image (argv[i]);
+                       pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
                  
-                 if (pixbuf)
-                 {
-                         new_testrgb_window (pixbuf);
-                         found_valid = TRUE;
-                 }
-         }
-  }
-
-  if (found_valid)
-    gtk_main ();
-
-  return 0;
+                       if (pixbuf) {
+                               new_testrgb_window (pixbuf);
+                               found_valid = TRUE;
+                       }
+               }
+       }
+
+       if (found_valid)
+               gtk_main ();
+
+       return 0;
 }
index e1a37347f4329c14aae31746954e485842891c92..714bde505025d0596464583afe17ffb4206de3d4 100644 (file)
@@ -1,3 +1,7 @@
+1999-10-18  Federico Mena Quintero  <federico@redhat.com>
+
+       * src/*: Reindented to use the GNOME Indentation.
+
 1999-10-18  Havoc Pennington  <hp@pobox.com>
 
        * configure.in: Use AM_PATH_GLIB instead of glib-config directly
index 0afe745a4f67a563c314ebff5ec2df8ba7753ef3..00669e7c162926481753668d9c212dd2281684d9 100644 (file)
@@ -4,12 +4,12 @@
 /* The optional cache interface */
 typedef struct {
        int dummy;
-} GdkPixBufCache;
+} GdkPixbufCache;
 
-GdkPixBufCache  *gdk_pixbuf_cache_new        (long image_cache_limit,
+GdkPixbufCache  *gdk_pixbuf_cache_new        (long image_cache_limit,
                                              long pixmap_bitmap_cache_limit);
-void             gdk_pixbuf_cache_destroy    (GdkPixBufCache *cache);
+void             gdk_pixbuf_cache_destroy    (GdkPixbufCache *cache);
 
-GdkPixBuf       *gdk_pixbuf_cache_load_image (GdkPixBufCache *cache,
+GdkPixbuf       *gdk_pixbuf_cache_load_image (GdkPixbufCache *cache,
                                              const char *file);
 #endif
index 1e8e7aedb2d292250bcda73d1aab595b7f80f4eb..b14244b4616e6116f2ad0a13971e2d0d11fc262d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * gdk-pixbuf-data.c: Code to load images into GdkPixBufs from constant data
+ * gdk-pixbuf-data.c: Code to load images into GdkPixbufs from constant data
  *
  * Author:
  *    Michael Fulbright (drmike@redhat.com)
 
 /* This function does all the work. */
 
-static GdkPixBuf *
+static GdkPixbuf *
 _pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
 {
-       GdkPixBuf *pixbuf;
+       GdkPixbuf *pixbuf;
        ArtPixBuf *art_pixbuf;
        art_u8 *pixels;
 
@@ -40,12 +40,10 @@ _pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
 }
 
 
-GdkPixBuf *
-gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, 
-                                 int rgb_width, int rgb_height)
+GdkPixbuf *
+gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height)
 {
        g_return_val_if_fail (data != NULL, NULL);
 
        return _pixbuf_create_from_rgb_d(data, rgb_width, rgb_height);
 }
-
index 5e8ed5dc6017232d11143c9a6f0af8da3bc14b6e..4335a2bee9243cd1977db03983024b4cc0a329bc 100644 (file)
@@ -4,11 +4,7 @@
 #include <gdk/gdk.h>
 #include <gdk-pixbuf.h>
 
-GdkPixBuf *gdk_pixbuf_rgb_from_drawable  (GdkWindow *window,
-                                         gint x, gint y,
-                                         gint width, gint height);
-GdkPixBuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window,
-                                         gint x, gint y,
-                                         gint width, gint height);
+GdkPixbuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height);
+GdkPixbuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height);
 
 #endif /* _GDK_PIXBUF_DRAWABLE_H_ */
index 72d611dbddaf234541c2fcc88199b0a7b8232207..a1400feba4484ab887bd5862620194fef80a706d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * gdk-pixbuf-io.c: Code to load images into GdkPixBufs
+ * gdk-pixbuf-io.c: Code to load images into GdkPixbufs
  *
  * Author:
  *    Miguel de Icaza (miguel@gnu.org)
@@ -106,7 +106,7 @@ pixbuf_check_ppm (unsigned char *buffer, int size)
        if (size < 20)
                return FALSE;
 
-       if (buffer [0] == 'P'){
+       if (buffer [0] == 'P') {
                if (buffer [1] == '1' ||
                    buffer [1] == '2' ||
                    buffer [1] == '3' ||
@@ -122,8 +122,8 @@ static struct {
        char      *module_name;
        gboolean   (*format_check)(unsigned char *buffer, int size);
        GModule   *module;
-       GdkPixBuf *(*load)(FILE *f);
-       int        (*save)(GdkPixBuf *p, FILE *f, ...);
+       GdkPixbuf *(*load)(FILE *f);
+       int        (*save)(GdkPixbuf *p, FILE *f, ...);
 } file_formats [] = {
        { "png",  pixbuf_check_png,  NULL, NULL, NULL },
        { "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL },
@@ -163,10 +163,10 @@ image_handler_load (int idx)
                file_formats [idx].save = save_sym;
 }
 
-GdkPixBuf *
+GdkPixbuf *
 gdk_pixbuf_load_image (const char *file)
 {
-       GdkPixBuf *pixbuf;
+       GdkPixbuf *pixbuf;
        gint n, i;
        FILE *f;
        char buffer [128];
@@ -176,17 +176,17 @@ gdk_pixbuf_load_image (const char *file)
                return NULL;
        n = fread (&buffer, 1, sizeof (buffer), f);
 
-       if (n == 0){
+       if (n == 0) {
                fclose (f);
                return NULL;
        }
 
-       for (i = 0; file_formats [i].module_name; i++){
-               if ((*file_formats [i].format_check)(buffer, n)){
+       for (i = 0; file_formats [i].module_name; i++) {
+               if ((*file_formats [i].format_check)(buffer, n)) {
                        if (!file_formats [i].load)
                                image_handler_load (i);
 
-                       if (!file_formats [i].load){
+                       if (!file_formats [i].load) {
                                fclose (f);
                                return NULL;
                        }
index a9f9a50a39a224553a978bfbd73c7587b31dd2f4..231f115a9716d3ffafe421bfaaed7f43b2128533 100644 (file)
@@ -1,14 +1,31 @@
-/*
- * gdk-pixbuf.c: Resource management.
+/* GdkPixbuf library
  *
- * Authors:
- *    Miguel de Icaza (miguel@gnu.org)
- *    Mark Crichton (crichton@gimp.org)
+ * Copyright (C) 1999 The Free Software Foundation
+ *
+ * Authors: Mark Crichton <crichton@gimp.org>
+ *          Miguel de Icaza <miguel@gnu.org>
+ *          Federico Mena-Quintero <federico@gimp.org>
+ *          Carsten Haitzler <raster@rasterman.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
 #include <config.h>
-#include <glib.h>
 #include <math.h>
+#include <glib.h>
 #include <libart_lgpl/art_misc.h>
 #include <libart_lgpl/art_affine.h>
 #include <libart_lgpl/art_pixbuf.h>
 #include <libart_lgpl/art_alphagamma.h>
 #include "gdk-pixbuf.h"
 
+\f
 
 void
-gdk_pixbuf_destroy (GdkPixBuf *pixbuf)
+gdk_pixbuf_destroy (GdkPixbuf *pixbuf)
 {
-     art_pixbuf_free (pixbuf->art_pixbuf);
-     pixbuf->art_pixbuf = NULL;
-     g_free (pixbuf);
+       art_pixbuf_free (pixbuf->art_pixbuf);
+       pixbuf->art_pixbuf = NULL;
+       g_free (pixbuf);
 }
 
-GdkPixBuf *
-gdk_pixbuf_new (ArtPixBuf          *art_pixbuf,
-               GdkPixBufUnrefFunc *unref_fn)
+GdkPixbuf *
+gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn)
 {
-       GdkPixBuf *pixbuf;
+       GdkPixbuf *pixbuf;
 
        if (!art_pixbuf)
                return NULL;
 
-       pixbuf             = g_new (GdkPixBuf, 1);
-       pixbuf->ref_count  = 1;
-       pixbuf->unref_fn   = unref_fn;
+       pixbuf = g_new (GdkPixbuf, 1);
+       pixbuf->ref_count = 1;
+       pixbuf->unref_fn = unref_fn;
        pixbuf->art_pixbuf = art_pixbuf;
 
        return pixbuf;
 }
 
 void
-gdk_pixbuf_ref (GdkPixBuf *pixbuf)
+gdk_pixbuf_ref (GdkPixbuf *pixbuf)
 {
-     g_return_if_fail (pixbuf != NULL);
-     g_return_if_fail (pixbuf->ref_count > 0);
+       g_return_if_fail (pixbuf != NULL);
+       g_return_if_fail (pixbuf->ref_count > 0);
 
-     pixbuf->ref_count++;
+       pixbuf->ref_count++;
 }
 
 void
-gdk_pixbuf_unref (GdkPixBuf *pixbuf)
+gdk_pixbuf_unref (GdkPixbuf *pixbuf)
 {
-    g_return_if_fail (pixbuf != NULL);
-    g_return_if_fail (pixbuf->ref_count > 0);
+       g_return_if_fail (pixbuf != NULL);
+       g_return_if_fail (pixbuf->ref_count > 0);
 
-    pixbuf->ref_count--;
+       pixbuf->ref_count--;
 
-    if (pixbuf->ref_count == 0)
-       gdk_pixbuf_destroy (pixbuf);
+       if (pixbuf->ref_count == 0)
+               gdk_pixbuf_destroy (pixbuf);
 }
 
-GdkPixBuf *
-gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h)
+GdkPixbuf *
+gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
 {
-    art_u8 *pixels;
-    gint rowstride;
-    double affine[6];
-    ArtAlphaGamma *alphagamma;
-    ArtPixBuf *art_pixbuf = NULL;
-    GdkPixBuf *copy = NULL;
+       art_u8 *pixels;
+       gint rowstride;
+       double affine[6];
+       ArtAlphaGamma *alphagamma;
+       ArtPixBuf *art_pixbuf = NULL;
+       GdkPixbuf *copy = NULL;
 
-    alphagamma = NULL;
+       alphagamma = NULL;
 
-    affine[1] = affine[2] = affine[4] = affine[5] = 0;
+       affine[1] = affine[2] = affine[4] = affine[5] = 0;
 
-    affine[0] = w / (double)(pixbuf->art_pixbuf->width);
-    affine[3] = h / (double)(pixbuf->art_pixbuf->height);
+       affine[0] = w / (double)(pixbuf->art_pixbuf->width);
+       affine[3] = h / (double)(pixbuf->art_pixbuf->height);
 
-    /*    rowstride = w * pixbuf->art_pixbuf->n_channels; */
-    rowstride = w * 3;
+       /* rowstride = w * pixbuf->art_pixbuf->n_channels; */
+       rowstride = w * 3;
 
-    pixels = art_alloc (h * rowstride);
-    art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
-                          pixbuf->art_pixbuf,
-                          affine, ART_FILTER_NEAREST, alphagamma);
+       pixels = art_alloc (h * rowstride);
+       art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
+                              pixbuf->art_pixbuf,
+                              affine, ART_FILTER_NEAREST, alphagamma);
 
-    if (pixbuf->art_pixbuf->has_alpha)
-           /* should be rgba */
-           art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
-    else
-           art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
+       if (pixbuf->art_pixbuf->has_alpha)
+               /* should be rgba */
+               art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
+       else
+               art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
 
-    copy = gdk_pixbuf_new (art_pixbuf, NULL);
+       copy = gdk_pixbuf_new (art_pixbuf, NULL);
 
-    if (!copy)
-           art_free (pixels);
-    
-    return copy;
+       if (!copy)
+               art_free (pixels);
+
+       return copy;
 }
 
-GdkPixBuf *
-gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
+GdkPixbuf *
+gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf)
 {
-       GdkPixBuf *copy  = g_new (GdkPixBuf, 1);
+       GdkPixbuf *copy  = g_new (GdkPixbuf, 1);
 
        copy->ref_count  = 1;
        copy->unref_fn   = pixbuf->unref_fn;
@@ -114,59 +131,59 @@ gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
        return copy;
 }
 
-GdkPixBuf *
-gdk_pixbuf_rotate (GdkPixBuf *pixbuf, gdouble angle)
+GdkPixbuf *
+gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle)
 {
-     art_u8 *pixels;
-     gint rowstride, w, h;
-     gdouble rad;
-     double rot[6], trans[6], affine[6];
-     ArtAlphaGamma *alphagamma = NULL;
-     ArtPixBuf *art_pixbuf = NULL;
-
-     w = pixbuf->art_pixbuf->width;
-     h = pixbuf->art_pixbuf->height;
-
-     rad = (M_PI * angle / 180.0);
-
-     rot[0] = cos(rad);
-     rot[1] = sin(rad);
-     rot[2] = -sin(rad);
-     rot[3] = cos(rad);
-     rot[4] = rot[5] = 0;
-
-     trans[0] = trans[3] = 1;
-     trans[1] = trans[2] = 0;
-     trans[4] = -(double)w / 2.0;
-     trans[5] = -(double)h / 2.0;
-
-     art_affine_multiply(rot, trans, rot);
-
-     trans[0] = trans[3] = 1;
-     trans[1] = trans[2] = 0;
-     trans[4] = (double)w / 2.0;
-     trans[5] = (double)h / 2.0;
-
-     art_affine_multiply(affine, rot, trans);
-
-     g_print("Affine: %e %e %e %e %e %e\n", affine[0], affine[1], affine[2],
-            affine[3], affine[4], affine[5]);
-
-     /* rowstride = w * pixbuf->art_pixbuf->n_channels; */
-     rowstride = w * 3;
-
-     pixels = art_alloc (h * rowstride);
-     art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
-                           pixbuf->art_pixbuf,
-                           affine, ART_FILTER_NEAREST, alphagamma);
-     if (pixbuf->art_pixbuf->has_alpha)
-         /* should be rgba */
-         art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
-     else
-         art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
-
-     art_pixbuf_free (pixbuf->art_pixbuf);
-     pixbuf->art_pixbuf = art_pixbuf;
-
-     return pixbuf;
+       art_u8 *pixels;
+       gint rowstride, w, h;
+       gdouble rad;
+       double rot[6], trans[6], affine[6];
+       ArtAlphaGamma *alphagamma = NULL;
+       ArtPixBuf *art_pixbuf = NULL;
+
+       w = pixbuf->art_pixbuf->width;
+       h = pixbuf->art_pixbuf->height;
+
+       rad = (M_PI * angle / 180.0);
+
+       rot[0] = cos(rad);
+       rot[1] = sin(rad);
+       rot[2] = -sin(rad);
+       rot[3] = cos(rad);
+       rot[4] = rot[5] = 0;
+
+       trans[0] = trans[3] = 1;
+       trans[1] = trans[2] = 0;
+       trans[4] = -(double)w / 2.0;
+       trans[5] = -(double)h / 2.0;
+
+       art_affine_multiply(rot, trans, rot);
+
+       trans[0] = trans[3] = 1;
+       trans[1] = trans[2] = 0;
+       trans[4] = (double)w / 2.0;
+       trans[5] = (double)h / 2.0;
+
+       art_affine_multiply(affine, rot, trans);
+
+       g_print("Affine: %e %e %e %e %e %e\n", affine[0], affine[1], affine[2],
+               affine[3], affine[4], affine[5]);
+
+       /* rowstride = w * pixbuf->art_pixbuf->n_channels; */
+       rowstride = w * 3;
+
+       pixels = art_alloc (h * rowstride);
+       art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
+                              pixbuf->art_pixbuf,
+                              affine, ART_FILTER_NEAREST, alphagamma);
+       if (pixbuf->art_pixbuf->has_alpha)
+               /* should be rgba */
+               art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
+       else
+               art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
+
+       art_pixbuf_free (pixbuf->art_pixbuf);
+       pixbuf->art_pixbuf = art_pixbuf;
+
+       return pixbuf;
 }
index 811f147f03526f383e333428a81439dea927c025..7f4cece9cd35e88e399c2052dcd4e1a48cc395b4 100644 (file)
@@ -1,34 +1,72 @@
-#ifndef _GDK_PIXBUF_H_
-#define _GDK_PIXBUF_H_
+/* GdkPixbuf library
+ *
+ * Copyright (C) 1999 The Free Software Foundation
+ *
+ * Authors: Mark Crichton <crichton@gimp.org>
+ *          Miguel de Icaza <miguel@gnu.org>
+ *          Federico Mena-Quintero <federico@gimp.org>
+ *          Carsten Haitzler <raster@rasterman.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GDK_PIXBUF_H
+#define GDK_PIXBUF_H
 
 #include <libart_lgpl/art_misc.h>
 #include <libart_lgpl/art_pixbuf.h>
 #include <glib.h>
 
-typedef struct _GdkPixBuf GdkPixBuf;
-typedef void (*GdkPixBufUnrefFunc) (GdkPixBuf *pixbuf);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+\f
 
-struct _GdkPixBuf
-{
-       int                 ref_count;
-       ArtPixBuf          *art_pixbuf;
-       GdkPixBufUnrefFunc *unref_fn;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef void (* GdkPixbufUnrefFunc) (GdkPixbuf *pixbuf);
+
+struct _GdkPixbuf {
+       int ref_count;
+       ArtPixBuf *art_pixbuf;
+       GdkPixbufUnrefFunc *unref_fn;
 };
 
-GdkPixBuf *gdk_pixbuf_load_image (const char *file);
-void       gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
-GdkPixBuf *gdk_pixbuf_new        (ArtPixBuf          *art_pixbuf,
-                                 GdkPixBufUnrefFunc *unref_fn);
-void       gdk_pixbuf_ref        (GdkPixBuf *pixbuf);
-void       gdk_pixbuf_unref      (GdkPixBuf *pixbuf);
-GdkPixBuf *gdk_pixbuf_duplicate  (const GdkPixBuf *pixbuf);
-GdkPixBuf *gdk_pixbuf_scale     (const GdkPixBuf *pixbuf, gint w, gint h);
-GdkPixBuf *gdk_pixbuf_rotate     (GdkPixBuf *pixbuf, gdouble angle);
+\f
+
+GdkPixbuf *gdk_pixbuf_load_image (const char *file);
+void gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
+
+GdkPixbuf *gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn);
+
+void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
+void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
+
+GdkPixbuf *gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf);
+GdkPixbuf *gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h);
+GdkPixbuf *gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle);
+
+void gdk_pixbuf_destroy (GdkPixbuf *pixbuf);
 
-void      gdk_pixbuf_destroy    (GdkPixBuf *pixbuf);
+GdkPixbuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height);
 
-GdkPixBuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, 
-                                            int rgb_width, int rgb_height);
+\f
 
+#ifdef __cplusplus
+}
+#endif
 
-#endif /* _GDK_PIXBUF_H_ */
+#endif
index 13451b4b2652c3cc52036d309612e5212bf42831..f58a32e01b2bf5d8147a142767eb572d44be3b67 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * io-bmp.c: GdkPixBuf I/O for BMP files.
+ * io-bmp.c: GdkPixbuf I/O for BMP files.
  *
  * Copyright (C) 1999 Mark Crichton
  * Author: Mark Crichton <crichton@gimp.org>
 /* Loosely based off the BMP loader from The GIMP, hence it's complexity */
 
 /* Shared library entry point */
-GdkPixBuf *image_load(FILE * f)
+GdkPixbuf *image_load(FILE * f)
 {
-    art_u8 *pixels;
-    ArtPixBuf *art_pixbuf;
+       art_u8 *pixels;
+       ArtPixBuf *art_pixbuf;
 
-    /* Ok, now stuff the GdkPixBuf with goodies */
+       /* Ok, now stuff the GdkPixbuf with goodies */
 
-    if (is_trans)
-           art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
-    else
-           art_pixbuf = art_pixbuf_new_rgb  (pixels, w, h, (w * 3));
+       if (is_trans)
+               art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
+       else
+               art_pixbuf = art_pixbuf_new_rgb  (pixels, w, h, (w * 3));
 
-    /* Ok, I'm anal...shoot me */
-    return gdk_pixbuf_new (art_pixbuf, NULL);
+       /* Ok, I'm anal...shoot me */
+       return gdk_pixbuf_new (art_pixbuf, NULL);
 }
index 98c9bbcaadcd360c24b584bb2044a47ea0fc77b5..87d97931f409ea2d3f7c1828032f6c728392afa3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * io-gif.c: GdkPixBuf I/O for GIF files.
+ * io-gif.c: GdkPixbuf I/O for GIF files.
  * ...second verse, same as the first...
  *
  * Copyright (C) 1999 Mark Crichton
 #include <gif_lib.h>
 
 /* Shared library entry point */
-GdkPixBuf *image_load(FILE * f)
+GdkPixbuf *
+image_load(FILE *f)
 {
-    gint fn, is_trans = FALSE;
-    gint done = 0;
-    gint t_color = -1;
-    gint w, h, i, j;
-    art_u8 *pixels, *tmpptr;
-    GifFileType *gif;
-    GifRowType *rows;
-    GifRecordType rec;
-    ColorMapObject *cmap;
-    int intoffset[] =
-    {0, 4, 2, 1};
-    int intjump[] =
-    {8, 8, 4, 2};
-
-    GdkPixBuf *pixbuf;
-    ArtPixBuf *art_pixbuf;
-
-    g_return_val_if_fail(f != NULL, NULL);
-
-    fn = fileno(f);
+       gint fn, is_trans = FALSE;
+       gint done = 0;
+       gint t_color = -1;
+       gint w, h, i, j;
+       art_u8 *pixels, *tmpptr;
+       GifFileType *gif;
+       GifRowType *rows;
+       GifRecordType rec;
+       ColorMapObject *cmap;
+       int intoffset[] =
+       {0, 4, 2, 1};
+       int intjump[] =
+       {8, 8, 4, 2};
+
+       GdkPixbuf *pixbuf;
+       ArtPixBuf *art_pixbuf;
+
+       g_return_val_if_fail(f != NULL, NULL);
+
+       fn = fileno(f);
 /*    lseek(fn, 0, 0);*/
-    gif = DGifOpenFileHandle(fn);
-
-    if (!gif) {
-       g_error("DGifOpenFilehandle FAILED");
-       PrintGifError();
-       return NULL;
-    }
-    /* Now we do the ungodly mess of loading a GIF image
-     * I used to remember when I liked this file format...
-     * of course, I still coded in assembler then.
-     * This comes from gdk_imlib, with some cleanups.
-     */
-
-    do {
-       if (DGifGetRecordType(gif, &rec) == GIF_ERROR) {
-           PrintGifError();
-           rec = TERMINATE_RECORD_TYPE;
-       }
-       if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) {
-           if (DGifGetImageDesc(gif) == GIF_ERROR) {
+       gif = DGifOpenFileHandle(fn);
+
+       if (!gif) {
+               g_error("DGifOpenFilehandle FAILED");
                PrintGifError();
-               rec = TERMINATE_RECORD_TYPE;
-           }
-           w = gif->Image.Width;
-           h = gif->Image.Height;
-           rows = g_malloc0(h * sizeof(GifRowType *));
-           if (!rows) {
-               DGifCloseFile(gif);
                return NULL;
-           }
-           for (i = 0; i < h; i++) {
-               rows[i] = g_malloc0(w * sizeof(GifPixelType));
-               if (!rows[i]) {
-                   DGifCloseFile(gif);
-                   for (i = 0; i < h; i++)
-                       if (rows[i])
-                           g_free(rows[i]);
-                   free(rows);
-                   return NULL;
-               }
-           }
-           if (gif->Image.Interlace) {
-               for (i = 0; i < 4; i++) {
-                   for (j = intoffset[i]; j < h; j += intjump[i])
-                       DGifGetLine(gif, rows[j], w);
+       }
+       /* Now we do the ungodly mess of loading a GIF image
+        * I used to remember when I liked this file format...
+        * of course, I still coded in assembler then.
+        * This comes from gdk_imlib, with some cleanups.
+        */
+
+       do {
+               if (DGifGetRecordType(gif, &rec) == GIF_ERROR) {
+                       PrintGifError();
+                       rec = TERMINATE_RECORD_TYPE;
                }
-           } else {
-               for (i = 0; i < h; i++)
-                   DGifGetLine(gif, rows[i], w);
-           }
-           done = 1;
-       } else if (rec == EXTENSION_RECORD_TYPE) {
-           gint ext_code;
-           GifByteType *ext;
-
-           DGifGetExtension(gif, &ext_code, &ext);
-           while (ext) {
-               if ((ext_code == 0xf9) &&
-                   (ext[1] & 1) && (t_color < 0)) {
-                   is_trans = TRUE;
-                   t_color = (gint) ext[4];
+               if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) {
+                       if (DGifGetImageDesc(gif) == GIF_ERROR) {
+                               PrintGifError();
+                               rec = TERMINATE_RECORD_TYPE;
+                       }
+                       w = gif->Image.Width;
+                       h = gif->Image.Height;
+                       rows = g_malloc0(h * sizeof(GifRowType *));
+                       if (!rows) {
+                               DGifCloseFile(gif);
+                               return NULL;
+                       }
+                       for (i = 0; i < h; i++) {
+                               rows[i] = g_malloc0(w * sizeof(GifPixelType));
+                               if (!rows[i]) {
+                                       DGifCloseFile(gif);
+                                       for (i = 0; i < h; i++)
+                                               if (rows[i])
+                                                       g_free(rows[i]);
+                                       free(rows);
+                                       return NULL;
+                               }
+                       }
+                       if (gif->Image.Interlace) {
+                               for (i = 0; i < 4; i++) {
+                                       for (j = intoffset[i]; j < h; j += intjump[i])
+                                               DGifGetLine(gif, rows[j], w);
+                               }
+                       } else {
+                               for (i = 0; i < h; i++)
+                                       DGifGetLine(gif, rows[i], w);
+                       }
+                       done = 1;
+               } else if (rec == EXTENSION_RECORD_TYPE) {
+                       gint ext_code;
+                       GifByteType *ext;
+
+                       DGifGetExtension(gif, &ext_code, &ext);
+                       while (ext) {
+                               if ((ext_code == 0xf9) &&
+                                   (ext[1] & 1) && (t_color < 0)) {
+                                       is_trans = TRUE;
+                                       t_color = (gint) ext[4];
+                               }
+                               ext = NULL;
+                               DGifGetExtensionNext(gif, &ext);
+                       }
                }
-               ext = NULL;
-               DGifGetExtensionNext(gif, &ext);
-           }
        }
-    }
-    while (rec != TERMINATE_RECORD_TYPE);
-
-    /* Ok, we're loaded, now to convert from indexed -> RGB
-     * with alpha if necessary
-     */
-
-    if (is_trans)
-       pixels = art_alloc(h * w * 4);
-    else
-       pixels = art_alloc(h * w * 3);
-    tmpptr = pixels;
-
-    if (!pixels)
-       return NULL;
-
-    /* The meat of the transformation */
-    /* Get the right palette */
-    cmap = (gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap);
-
-    /* Unindex the data, and pack it in RGB(A) order.
-     * Note for transparent GIFs, the alpha is set to 0
-     * for the transparent color, and 0xFF for everything else.
-     * I think that's right...
-     */
-
-    for (i = 0; i < h; i++) {
-       for (j = 0; j < w; j++) {
-           tmpptr[0] = cmap->Colors[rows[i][j]].Red;
-           tmpptr[1] = cmap->Colors[rows[i][j]].Green;
-           tmpptr[2] = cmap->Colors[rows[i][j]].Blue;
-           if (is_trans && (rows[i][j] == t_color))
-               tmpptr[3] = 0;
-           else
-               tmpptr[3] = 0xFF;
-           tmpptr += (is_trans ? 4 : 3);
+       while (rec != TERMINATE_RECORD_TYPE);
+
+       /* Ok, we're loaded, now to convert from indexed -> RGB
+        * with alpha if necessary
+        */
+
+       if (is_trans)
+               pixels = art_alloc(h * w * 4);
+       else
+               pixels = art_alloc(h * w * 3);
+       tmpptr = pixels;
+
+       if (!pixels)
+               return NULL;
+
+       /* The meat of the transformation */
+       /* Get the right palette */
+       cmap = (gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap);
+
+       /* Unindex the data, and pack it in RGB(A) order.
+        * Note for transparent GIFs, the alpha is set to 0
+        * for the transparent color, and 0xFF for everything else.
+        * I think that's right...
+        */
+
+       for (i = 0; i < h; i++) {
+               for (j = 0; j < w; j++) {
+                       tmpptr[0] = cmap->Colors[rows[i][j]].Red;
+                       tmpptr[1] = cmap->Colors[rows[i][j]].Green;
+                       tmpptr[2] = cmap->Colors[rows[i][j]].Blue;
+                       if (is_trans && (rows[i][j] == t_color))
+                               tmpptr[3] = 0;
+                       else
+                               tmpptr[3] = 0xFF;
+                       tmpptr += (is_trans ? 4 : 3);
+               }
+               g_free(rows[i]);
        }
-       g_free(rows[i]);
-    }
-    g_free(rows);
+       g_free(rows);
 
-    if (is_trans)
-           art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
-    else
-           art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3));
+       if (is_trans)
+               art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
+       else
+               art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3));
 
-    pixbuf = gdk_pixbuf_new (art_pixbuf, NULL);
+       pixbuf = gdk_pixbuf_new (art_pixbuf, NULL);
 
-    /* Ok, I'm anal...shoot me */
-    if (!pixbuf)
-        art_free(pixels);
+       /* Ok, I'm anal...shoot me */
+       if (!pixbuf)
+               art_free(pixels);
 
-    return pixbuf;
+       return pixbuf;
 }
 
 image_save() {}
index aa9fa775f185ad4157b2ffdf0456a9c5f9a3545b..448e8c4fd1f2130785465d5d298fa30005a3132e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  io-jpeg.c: GdkPixBuf loader for jpeg files.
+  io-jpeg.c: GdkPixbuf loader for jpeg files.
 
   Based on io-jpeg from gdk_imlib, but not much.
 
 #include <jpeglib.h>
 
 /* error handler data */
-struct iojpeg_JPEG_error_mgr
-{
+struct iojpeg_JPEG_error_mgr {
        struct jpeg_error_mgr pub;
-       sigjmp_buf          setjmp_buffer;
+       sigjmp_buf setjmp_buffer;
 };
 
 static void
@@ -39,17 +38,18 @@ g_JPEGFatalErrorHandler(j_common_ptr cinfo)
        return;
 }
 
-GdkPixBuf *image_load(FILE *f)
+GdkPixbuf *
+image_load(FILE *f)
 {
        int w,h,i,j;
        art_u8 *pixels=NULL, *dptr;
        unsigned char *lines[4], /* Used to expand rows, via rec_outbuf_height, from
-                                 the header file:
-                                 "* Usually rec_outbuf_height will be 1 or 2, at most 4." */
+                                   the header file:
+                                   "* Usually rec_outbuf_height will be 1 or 2, at most 4." */
                **lptr;
        struct jpeg_decompress_struct cinfo;
        struct iojpeg_JPEG_error_mgr jerr;
-       GdkPixBuf *pixbuf;
+       GdkPixbuf *pixbuf;
 
        /* setup error handler */
        cinfo.err = jpeg_std_error(&(jerr.pub));
index c574deab123e79dd7098f3ee92bb6ca3923baab8..b1a3971a88ab22f7cfb039ae2f8030be7bb8c4ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * io-png.c: GdkPixBuf I/O for PNG files.
+ * io-png.c: GdkPixbuf I/O for PNG files.
  * Copyright (C) 1999 Mark Crichton
  * Author: Mark Crichton <crichton@gimp.org>
  *
 #include <png.h>
 
 /* Shared library entry point */
-GdkPixBuf *image_load(FILE * f)
+GdkPixbuf *
+image_load (FILE *f)
 {
-    png_structp png_ptr;
-    png_infop info_ptr, end_info;
-    gint i, depth, ctype, inttype, passes, bpp;                /* bpp = BYTES/pixel */
-    png_uint_32 w, h, x, y;
-    png_bytepp rows;
-    art_u8 *pixels, *temp, *rowdata;
-    GdkPixBuf *pixbuf;
-    ArtPixBuf *art_pixbuf;
-
-    g_return_val_if_fail (f != NULL, NULL);
-
-    png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
-                                     NULL, NULL, NULL);
-    if (!png_ptr)
-           return NULL;
-
-    info_ptr = png_create_info_struct (png_ptr);
-    if (!info_ptr) {
-           png_destroy_read_struct (&png_ptr, NULL, NULL);
-           return NULL;
-    }
-
-    end_info = png_create_info_struct (png_ptr);
-    if (!end_info) {
-           png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
-           return NULL;
-    }
-
-    if (setjmp (png_ptr->jmpbuf)) {
-           png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
-           return NULL;
-    }
-
-    png_init_io   (png_ptr, f);
-    png_read_info (png_ptr, info_ptr);
-    png_get_IHDR  (png_ptr, info_ptr, &w, &h, &depth, &ctype, &inttype,
-                  NULL, NULL);
-
-    /* Ok, we want to work with 24 bit images.
-     * However, PNG can vary depth per channel.
-     * So, we use the png_set_expand function to expand
-     * everything into a format libart expects.
-     * We also use png_set_strip_16 to reduce down to 8 bit/chan.
-     */
-    if (ctype == PNG_COLOR_TYPE_PALETTE && depth <= 8)
-       png_set_expand (png_ptr);
-
-    if (ctype == PNG_COLOR_TYPE_GRAY && depth < 8)
-       png_set_expand (png_ptr);
-
-    if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
-       png_set_expand (png_ptr);
-       g_warning ("FIXME: We are going to crash");
-    }
-
-    if (depth == 16)
-       png_set_strip_16 (png_ptr);
-
-    /* We also have png "packing" bits into bytes if < 8 */
-    if (depth < 8)
-       png_set_packing (png_ptr);
-
-    /* Lastly, if the PNG is greyscale, convert to RGB */
-    if (ctype == PNG_COLOR_TYPE_GRAY || ctype == PNG_COLOR_TYPE_GRAY_ALPHA)
-       png_set_gray_to_rgb (png_ptr);
-
-    /* ...and if we're interlaced... */
-    passes = png_set_interlace_handling (png_ptr);
-
-    /* Update our info structs */
-    png_read_update_info (png_ptr, info_ptr);
-
-    /* Allocate some memory and set up row array */
-    /* This "inhales vigorously"... */
-    if (ctype & PNG_COLOR_MASK_ALPHA)
-       bpp = 4;
-    else
-       bpp = 3;
-
-    pixels = art_alloc (w * h * bpp);
-    rows   = g_malloc  (h * sizeof(png_bytep));
-
-    if (!pixels || !rows) {
-       png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
-       return NULL;
-    }
-    /* Icky code, but it has to be done... */
-    for (i = 0; i < h; i++) {
-       if ((rows[i] = g_malloc (w * sizeof (art_u8) * bpp)) == NULL) {
-           int n;
-           for (n = 0; n < i; n++)
-               g_free (rows[i]);
-           g_free (rows);
-           art_free (pixels);
-           png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
-           return NULL;
+       png_structp png_ptr;
+       png_infop info_ptr, end_info;
+       gint i, depth, ctype, inttype, passes, bpp;             /* bpp = BYTES/pixel */
+       png_uint_32 w, h, x, y;
+       png_bytepp rows;
+       art_u8 *pixels, *temp, *rowdata;
+       GdkPixbuf *pixbuf;
+       ArtPixBuf *art_pixbuf;
+
+       g_return_val_if_fail (f != NULL, NULL);
+
+       png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
+                                         NULL, NULL, NULL);
+       if (!png_ptr)
+               return NULL;
+
+       info_ptr = png_create_info_struct (png_ptr);
+       if (!info_ptr) {
+               png_destroy_read_struct (&png_ptr, NULL, NULL);
+               return NULL;
+       }
+
+       end_info = png_create_info_struct (png_ptr);
+       if (!end_info) {
+               png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
+               return NULL;
+       }
+
+       if (setjmp (png_ptr->jmpbuf)) {
+               png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+               return NULL;
+       }
+
+       png_init_io   (png_ptr, f);
+       png_read_info (png_ptr, info_ptr);
+       png_get_IHDR  (png_ptr, info_ptr, &w, &h, &depth, &ctype, &inttype,
+                      NULL, NULL);
+
+       /* Ok, we want to work with 24 bit images.
+        * However, PNG can vary depth per channel.
+        * So, we use the png_set_expand function to expand
+        * everything into a format libart expects.
+        * We also use png_set_strip_16 to reduce down to 8 bit/chan.
+        */
+       if (ctype == PNG_COLOR_TYPE_PALETTE && depth <= 8)
+               png_set_expand (png_ptr);
+
+       if (ctype == PNG_COLOR_TYPE_GRAY && depth < 8)
+               png_set_expand (png_ptr);
+
+       if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
+               png_set_expand (png_ptr);
+               g_warning ("FIXME: We are going to crash");
        }
-    }
 
-    /* And we FINALLY get here... */
-    png_read_image (png_ptr, rows);
-    png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+       if (depth == 16)
+               png_set_strip_16 (png_ptr);
 
-    /* Now stuff the bytes into pixels & free rows[y] */
+       /* We also have png "packing" bits into bytes if < 8 */
+       if (depth < 8)
+               png_set_packing (png_ptr);
 
-    temp = pixels;
+       /* Lastly, if the PNG is greyscale, convert to RGB */
+       if (ctype == PNG_COLOR_TYPE_GRAY || ctype == PNG_COLOR_TYPE_GRAY_ALPHA)
+               png_set_gray_to_rgb (png_ptr);
 
-    for (y = 0; y < h; y++) {
-       (png_bytep) rowdata = rows[y];
-       for (x = 0; x < w; x++) {
-           temp[0] = rowdata[(x * bpp)];
-           temp[1] = rowdata[(x * bpp) + 1];
-           temp[2] = rowdata[(x * bpp) + 2];
-           if (bpp == 4)
-               temp[3] = rowdata[(x * bpp) + 3];
-           temp += bpp;
+       /* ...and if we're interlaced... */
+       passes = png_set_interlace_handling (png_ptr);
+
+       /* Update our info structs */
+       png_read_update_info (png_ptr, info_ptr);
+
+       /* Allocate some memory and set up row array */
+       /* This "inhales vigorously"... */
+       if (ctype & PNG_COLOR_MASK_ALPHA)
+               bpp = 4;
+       else
+               bpp = 3;
+
+       pixels = art_alloc (w * h * bpp);
+       rows   = g_malloc  (h * sizeof(png_bytep));
+
+       if (!pixels || !rows) {
+               png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+               return NULL;
+       }
+       /* Icky code, but it has to be done... */
+       for (i = 0; i < h; i++) {
+               if ((rows[i] = g_malloc (w * sizeof (art_u8) * bpp)) == NULL) {
+                       int n;
+                       for (n = 0; n < i; n++)
+                               g_free (rows[i]);
+                       g_free (rows);
+                       art_free (pixels);
+                       png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+                       return NULL;
+               }
        }
-       g_free (rows[y]);
-    }
-    g_free (rows);
 
-    if (ctype & PNG_COLOR_MASK_ALPHA)
-           art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
-    else
-           art_pixbuf = art_pixbuf_new_rgb  (pixels, w, h, (w * 3));
+       /* And we FINALLY get here... */
+       png_read_image (png_ptr, rows);
+       png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
 
-    pixbuf = gdk_pixbuf_new (art_pixbuf, NULL);
+       /* Now stuff the bytes into pixels & free rows[y] */
+
+       temp = pixels;
+
+       for (y = 0; y < h; y++) {
+               (png_bytep) rowdata = rows[y];
+               for (x = 0; x < w; x++) {
+                       temp[0] = rowdata[(x * bpp)];
+                       temp[1] = rowdata[(x * bpp) + 1];
+                       temp[2] = rowdata[(x * bpp) + 2];
+                       if (bpp == 4)
+                               temp[3] = rowdata[(x * bpp) + 3];
+                       temp += bpp;
+               }
+               g_free (rows[y]);
+       }
+       g_free (rows);
 
-    if (!pixbuf)
-        art_free (pixels);
+       if (ctype & PNG_COLOR_MASK_ALPHA)
+               art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
+       else
+               art_pixbuf = art_pixbuf_new_rgb  (pixels, w, h, (w * 3));
 
-    return pixbuf;
+       pixbuf = gdk_pixbuf_new (art_pixbuf, NULL);
+
+       if (!pixbuf)
+               art_free (pixels);
+
+       return pixbuf;
 }
 
-int image_save(GdkPixBuf *pixbuf, FILE *file)
+int
+image_save (GdkPixbuf *pixbuf, FILE *file)
 {
-     png_structp png_ptr;
-     png_infop info_ptr;
-     art_u8 *data;
-     gint y, h, w;
-     png_bytepp row_ptr;
-     png_color_8 sig_bit;
-     gint type;
-
-     g_return_val_if_fail(file != NULL, FALSE);
-     g_return_val_if_fail(pixbuf != NULL, FALSE);
-
-     h = pixbuf->art_pixbuf->height;
-     w = pixbuf->art_pixbuf->width;
-
-     png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
-                                      NULL, NULL, NULL);
-     if (png_ptr == NULL) {
-         fclose(file);
-         return FALSE;
-     }
-
-     info_ptr = png_create_info_struct(png_ptr);
-     if (info_ptr == NULL) {
-         fclose(file);
-         png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
-         return FALSE;
-     }
-
-     if (setjmp(png_ptr->jmpbuf)) {
-         fclose(file);
-         png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
-         return FALSE;
-     }
-
-     png_init_io(png_ptr, file);
-     if (pixbuf->art_pixbuf->has_alpha) {
-         sig_bit.alpha = 8;
-         type = PNG_COLOR_TYPE_RGB_ALPHA;
-     } else {
-         sig_bit.alpha = 0;
-         type = PNG_COLOR_TYPE_RGB;
-     }
-
-     sig_bit.red = sig_bit.green = sig_bit.blue = 8;
-     png_set_IHDR(png_ptr, info_ptr, w, h, 8, type, PNG_INTERLACE_NONE,
-                 PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
-     png_set_sBIT(png_ptr, info_ptr, &sig_bit);
-     png_write_info(png_ptr, info_ptr);
-     png_set_shift(png_ptr, &sig_bit);
-     png_set_packing(png_ptr);
-
-     data = pixbuf->art_pixbuf->pixels;
-     row_ptr = g_new(png_byte *, h);
-
-     for (y = 0; y < h; y++)
-        row_ptr[y] = data + y * pixbuf->art_pixbuf->rowstride;
+       png_structp png_ptr;
+       png_infop info_ptr;
+       art_u8 *data;
+       gint y, h, w;
+       png_bytepp row_ptr;
+       png_color_8 sig_bit;
+       gint type;
+
+       g_return_val_if_fail(file != NULL, FALSE);
+       g_return_val_if_fail(pixbuf != NULL, FALSE);
+
+       h = pixbuf->art_pixbuf->height;
+       w = pixbuf->art_pixbuf->width;
+
+       png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+                                         NULL, NULL, NULL);
+       if (png_ptr == NULL) {
+               fclose(file);
+               return FALSE;
+       }
+
+       info_ptr = png_create_info_struct(png_ptr);
+       if (info_ptr == NULL) {
+               fclose(file);
+               png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+               return FALSE;
+       }
+
+       if (setjmp(png_ptr->jmpbuf)) {
+               fclose(file);
+               png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+               return FALSE;
+       }
+
+       png_init_io(png_ptr, file);
+       if (pixbuf->art_pixbuf->has_alpha) {
+               sig_bit.alpha = 8;
+               type = PNG_COLOR_TYPE_RGB_ALPHA;
+       } else {
+               sig_bit.alpha = 0;
+               type = PNG_COLOR_TYPE_RGB;
+       }
+
+       sig_bit.red = sig_bit.green = sig_bit.blue = 8;
+       png_set_IHDR(png_ptr, info_ptr, w, h, 8, type, PNG_INTERLACE_NONE,
+                    PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+       png_set_sBIT(png_ptr, info_ptr, &sig_bit);
+       png_write_info(png_ptr, info_ptr);
+       png_set_shift(png_ptr, &sig_bit);
+       png_set_packing(png_ptr);
+
+       data = pixbuf->art_pixbuf->pixels;
+       row_ptr = g_new(png_byte *, h);
+
+       for (y = 0; y < h; y++)
+               row_ptr[y] = data + y * pixbuf->art_pixbuf->rowstride;
 #if 0
-     {
-         if (pixbuf->art_pixbuf->has_alpha)
-              row_ptr[y] = data + (w * y * 4);
-         else
-              row_ptr[y] = data + (w * y * 3);
-     }
+       {
+               if (pixbuf->art_pixbuf->has_alpha)
+                       row_ptr[y] = data + (w * y * 4);
+               else
+                       row_ptr[y] = data + (w * y * 3);
+       }
 #endif
 
-     png_write_image(png_ptr, row_ptr);
-     g_free (row_ptr);
+       png_write_image(png_ptr, row_ptr);
+       g_free (row_ptr);
 
-     png_write_end(png_ptr, info_ptr);
-     png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+       png_write_end(png_ptr, info_ptr);
+       png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
 
-     return TRUE;
+       return TRUE;
 }
index 1ade9ce296118ab346d4df3d1da594aa1b41f2fc..6fa935d7db5010e1b235601817c83652029bfdec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * io-tiff.c: GdkPixBuf I/O for TIFF files.
+ * io-tiff.c: GdkPixbuf I/O for TIFF files.
  * Copyright (C) 1999 Mark Crichton
  * Author: Mark Crichton <crichton@gimp.org>
  *
 #include "gdk-pixbuf.h"
 /*#include "gdk-pixbuf-io.h" */
 
-GdkPixBuf *image_load(FILE * f)
+GdkPixbuf *
+image_load (FILE *f)
 {
-    GdkPixBuf *pixbuf;
-    TIFF *tiff;
-    art_u8 *pixels, *tmppix;
-    gint w, h, x, y, num_pixs, fd;
-    uint32 *rast, *tmp_rast;
+       GdkPixbuf *pixbuf;
+       TIFF *tiff;
+       art_u8 *pixels, *tmppix;
+       gint w, h, x, y, num_pixs, fd;
+       uint32 *rast, *tmp_rast;
 
-    g_return_val_if_fail(f != NULL, NULL);
+       g_return_val_if_fail(f != NULL, NULL);
 
-    fd = fileno(f);
-    tiff = TIFFFdOpen(fd, "libpixbuf-tiff", "r");
+       fd = fileno(f);
+       tiff = TIFFFdOpen(fd, "libpixbuf-tiff", "r");
 
-    if (!tiff)
-       return NULL;
+       if (!tiff)
+               return NULL;
 
-    TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
-    TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
-    num_pixs = w * h;
+       TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
+       TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
+       num_pixs = w * h;
 
-    /* Yes, it needs to be _TIFFMalloc... */
-    rast = (uint32 *) _TIFFmalloc(num_pixs * sizeof(uint32));
+       /* Yes, it needs to be _TIFFMalloc... */
+       rast = (uint32 *) _TIFFmalloc(num_pixs * sizeof(uint32));
 
-    if (!rast) {
-       TIFFClose(tiff);
-       return NULL;
-    }
-
-    if (TIFFReadRGBAImage(tiff, w, h, rast, 0)) {
-       pixels = art_alloc(num_pixs * 4);
-       if (!pixels) {
-           _TIFFfree(rast);
-           TIFFClose(tiff);
-           return NULL;
+       if (!rast) {
+               TIFFClose(tiff);
+               return NULL;
        }
-       tmppix = pixels;
 
-       for (y = 0; y < h; y++) {
-           /* Unexplainable...are tiffs backwards? */
-           /* Also looking at the GIMP plugin, this
-            * whole reading thing can be a bit more
-            * robust.
-            */
-           tmp_rast = rast + ((h - y - 1) * w);
-           for (x = 0; x < w; x++) {
-               tmppix[0] = TIFFGetR(*tmp_rast);
-               tmppix[1] = TIFFGetG(*tmp_rast);
-               tmppix[2] = TIFFGetB(*tmp_rast);
-               tmppix[3] = TIFFGetA(*tmp_rast);
-               tmp_rast++;
-               tmppix += 4;
-           }
+       if (TIFFReadRGBAImage(tiff, w, h, rast, 0)) {
+               pixels = art_alloc(num_pixs * 4);
+               if (!pixels) {
+                       _TIFFfree(rast);
+                       TIFFClose(tiff);
+                       return NULL;
+               }
+               tmppix = pixels;
+
+               for (y = 0; y < h; y++) {
+                       /* Unexplainable...are tiffs backwards? */
+                       /* Also looking at the GIMP plugin, this
+                        * whole reading thing can be a bit more
+                        * robust.
+                        */
+                       tmp_rast = rast + ((h - y - 1) * w);
+                       for (x = 0; x < w; x++) {
+                               tmppix[0] = TIFFGetR(*tmp_rast);
+                               tmppix[1] = TIFFGetG(*tmp_rast);
+                               tmppix[2] = TIFFGetB(*tmp_rast);
+                               tmppix[3] = TIFFGetA(*tmp_rast);
+                               tmp_rast++;
+                               tmppix += 4;
+                       }
+               }
        }
-    }
-    _TIFFfree(rast);
-    TIFFClose(tiff);
+       _TIFFfree(rast);
+       TIFFClose(tiff);
 
-    pixbuf = gdk_pixbuf_new (art_pixbuf_new_rgba (pixels, w, h, (w * 4)),
-                            NULL);
+       pixbuf = gdk_pixbuf_new (art_pixbuf_new_rgba (pixels, w, h, (w * 4)),
+                                NULL);
 
-    if (!pixbuf)
-           art_free (pixels);
+       if (!pixbuf)
+               art_free (pixels);
 
-    return pixbuf;
+       return pixbuf;
 }
index 6cd89fc3c1bb53e8c42c32fee3c196a6e84d1270..d21fe0434ad3879c07d82d00271a2cc6f0405e5e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * io-xpm.c: GdkPixBuf I/O for XPM files.
+ * io-xpm.c: GdkPixbuf I/O for XPM files.
  * Copyright (C) 1999 Mark Crichton
  * Author: Mark Crichton <crichton@gimp.org>
  *
  */
 
 enum buf_op {
-    op_header,
-    op_cmap,
-    op_body
+       op_header,
+       op_cmap,
+       op_body
 };
 
 typedef struct {
-    gchar *color_string;
-    GdkColor color;
-    gint transparent;
+       gchar *color_string;
+       GdkColor color;
+       gint transparent;
 } _XPMColor;
 
 struct file_handle {
-    FILE *infile;
-    gchar *buffer;
-    guint buffer_size;
+       FILE *infile;
+       gchar *buffer;
+       guint buffer_size;
 } file_handle;
 
 struct mem_handle {
-    gchar **data;
-    int offset;
+       gchar **data;
+       int offset;
 } mem_handle;
 
 static gint
- xpm_seek_string(FILE * infile,
-                const gchar * str,
-                gint skip_comments)
+xpm_seek_string(FILE *infile, const gchar *str, gint skip_comments)
 {
-    char instr[1024];
+       char instr[1024];
 
-    while (!feof(infile)) {
-       fscanf(infile, "%1023s", instr);
-       if (skip_comments == TRUE && strcmp(instr, "/*") == 0) {
-           fscanf(infile, "%1023s", instr);
-           while (!feof(infile) && strcmp(instr, "*/") != 0)
+       while (!feof(infile)) {
                fscanf(infile, "%1023s", instr);
-           fscanf(infile, "%1023s", instr);
+               if (skip_comments == TRUE && strcmp(instr, "/*") == 0) {
+                       fscanf(infile, "%1023s", instr);
+                       while (!feof(infile) && strcmp(instr, "*/") != 0)
+                               fscanf(infile, "%1023s", instr);
+                       fscanf(infile, "%1023s", instr);
+               }
+               if (strcmp(instr, str) == 0)
+                       return TRUE;
        }
-       if (strcmp(instr, str) == 0)
-           return TRUE;
-    }
 
-    return FALSE;
+       return FALSE;
 }
 
 static gint
- xpm_seek_char(FILE * infile,
-              gchar c)
+xpm_seek_char(FILE *infile, gchar c)
 {
-    gint b, oldb;
-
-    while ((b = getc(infile)) != EOF) {
-       if (c != b && b == '/') {
-           b = getc(infile);
-           if (b == EOF)
-               return FALSE;
-           else if (b == '*') {        /* we have a comment */
-               b = -1;
-               do {
-                   oldb = b;
-                   b = getc(infile);
-                   if (b == EOF)
-                       return FALSE;
-               }
-               while (!(oldb == '*' && b == '/'));
-           }
-       } else if (c == b)
-           return TRUE;
-    }
-    return FALSE;
+       gint b, oldb;
+
+       while ((b = getc(infile)) != EOF) {
+               if (c != b && b == '/') {
+                       b = getc(infile);
+                       if (b == EOF)
+                               return FALSE;
+                       else if (b == '*') {    /* we have a comment */
+                               b = -1;
+                               do {
+                                       oldb = b;
+                                       b = getc(infile);
+                                       if (b == EOF)
+                                               return FALSE;
+                               }
+                               while (!(oldb == '*' && b == '/'));
+                       }
+               } else if (c == b)
+                       return TRUE;
+       }
+       return FALSE;
 }
 
 static gint
- xpm_read_string(FILE * infile,
-                gchar ** buffer,
-                guint * buffer_size)
+xpm_read_string(FILE *infile, gchar **buffer, guint *buffer_size)
 {
-    gint c;
-    guint cnt = 0, bufsiz, ret = FALSE;
-    gchar *buf;
-
-    buf = *buffer;
-    bufsiz = *buffer_size;
-    if (buf == NULL) {
-       bufsiz = 10 * sizeof(gchar);
-       buf = g_new(gchar, bufsiz);
-    }
-    do
-       c = getc(infile);
-    while (c != EOF && c != '"');
-
-    if (c != '"')
-       goto out;
-
-    while ((c = getc(infile)) != EOF) {
-       if (cnt == bufsiz) {
-           guint new_size = bufsiz * 2;
-           if (new_size > bufsiz)
-               bufsiz = new_size;
-           else
-               goto out;
-
-           buf = (gchar *) g_realloc(buf, bufsiz);
-           buf[bufsiz - 1] = '\0';
+       gint c;
+       guint cnt = 0, bufsiz, ret = FALSE;
+       gchar *buf;
+
+       buf = *buffer;
+       bufsiz = *buffer_size;
+       if (buf == NULL) {
+               bufsiz = 10 * sizeof(gchar);
+               buf = g_new(gchar, bufsiz);
        }
+
+       do {
+               c = getc(infile);
+       } while (c != EOF && c != '"');
+
        if (c != '"')
-           buf[cnt++] = c;
-       else {
-           buf[cnt] = 0;
-           ret = TRUE;
-           break;
+               goto out;
+
+       while ((c = getc(infile)) != EOF) {
+               if (cnt == bufsiz) {
+                       guint new_size = bufsiz * 2;
+                       if (new_size > bufsiz)
+                               bufsiz = new_size;
+                       else
+                               goto out;
+
+                       buf = (gchar *) g_realloc(buf, bufsiz);
+                       buf[bufsiz - 1] = '\0';
+               }
+               if (c != '"')
+                       buf[cnt++] = c;
+               else {
+                       buf[cnt] = 0;
+                       ret = TRUE;
+                       break;
+               }
        }
-    }
 
 out:
-    buf[bufsiz - 1] = '\0';    /* ensure null termination for errors */
-    *buffer = buf;
-    *buffer_size = bufsiz;
-    return ret;
+ out:
+       buf[bufsiz - 1] = '\0'; /* ensure null termination for errors */
+       *buffer = buf;
+       *buffer_size = bufsiz;
+       return ret;
 }
 
 static gchar *
- xpm_skip_whitespaces(gchar * buffer)
+xpm_skip_whitespaces(gchar *buffer)
 {
-    gint32 index = 0;
+       gint32 index = 0;
 
-    while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
-       index++;
+       while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
+               index++;
 
-    return &buffer[index];
+       return &buffer[index];
 }
 
 static gchar *
- xpm_skip_string(gchar * buffer)
+xpm_skip_string(gchar *buffer)
 {
-    gint32 index = 0;
+       gint32 index = 0;
 
-    while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
-       index++;
+       while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
+               index++;
 
-    return &buffer[index];
+       return &buffer[index];
 }
 
 /* Xlib crashed once at a color name lengths around 125 */
 #define MAX_COLOR_LEN 120
 
 static gchar *
- xpm_extract_color(gchar * buffer)
+xpm_extract_color(gchar *buffer)
 {
-    gint counter, numnames;
-    gchar *ptr = NULL, ch, temp[128];
-    gchar color[MAX_COLOR_LEN], *retcol;
-    gint space;
-    counter = 0;
-    while (ptr == NULL) {
-       if (buffer[counter] == 'c') {
-           ch = buffer[counter + 1];
-           if (ch == 0x20 || ch == 0x09)
-               ptr = &buffer[counter + 1];
-       } else if (buffer[counter] == 0)
-           return NULL;
-
-       counter++;
-    }
-    ptr = xpm_skip_whitespaces(ptr);
-
-    if (ptr[0] == 0)
-       return NULL;
-    else if (ptr[0] == '#') {
-       counter = 1;
-       while (ptr[counter] != 0 &&
-              ((ptr[counter] >= '0' && ptr[counter] <= '9') ||
-               (ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
-               (ptr[counter] >= 'A' && ptr[counter] <= 'F')))
-           counter++;
-       retcol = g_new(gchar, counter + 1);
-       strncpy(retcol, ptr, counter);
-
-       retcol[counter] = 0;
-
-       return retcol;
-    }
-    color[0] = 0;
-    numnames = 0;
-
-    space = MAX_COLOR_LEN - 1;
-    while (space > 0) {
-       sscanf(ptr, "%127s", temp);
-
-       if (((gint) ptr[0] == 0) ||
-           (strcmp("s", temp) == 0) || (strcmp("m", temp) == 0) ||
-           (strcmp("g", temp) == 0) || (strcmp("g4", temp) == 0)) {
-           break;
-       } else {
-           if (numnames > 0) {
-               space -= 1;
-               strcat(color, " ");
-           }
-           strncat(color, temp, space);
-           space -= MIN(space, strlen(temp));
-           ptr = xpm_skip_string(ptr);
-           ptr = xpm_skip_whitespaces(ptr);
-           numnames++;
+       gint counter, numnames;
+       gchar *ptr = NULL, ch, temp[128];
+       gchar color[MAX_COLOR_LEN], *retcol;
+       gint space;
+       counter = 0;
+       while (ptr == NULL) {
+               if (buffer[counter] == 'c') {
+                       ch = buffer[counter + 1];
+                       if (ch == 0x20 || ch == 0x09)
+                               ptr = &buffer[counter + 1];
+               } else if (buffer[counter] == 0)
+                       return NULL;
+
+               counter++;
+       }
+       ptr = xpm_skip_whitespaces(ptr);
+
+       if (ptr[0] == 0)
+               return NULL;
+       else if (ptr[0] == '#') {
+               counter = 1;
+               while (ptr[counter] != 0 &&
+                      ((ptr[counter] >= '0' && ptr[counter] <= '9') ||
+                       (ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
+                       (ptr[counter] >= 'A' && ptr[counter] <= 'F')))
+                       counter++;
+               retcol = g_new(gchar, counter + 1);
+               strncpy(retcol, ptr, counter);
+
+               retcol[counter] = 0;
+
+               return retcol;
+       }
+       color[0] = 0;
+       numnames = 0;
+
+       space = MAX_COLOR_LEN - 1;
+       while (space > 0) {
+               sscanf(ptr, "%127s", temp);
+
+               if (((gint) ptr[0] == 0) ||
+                   (strcmp("s", temp) == 0) || (strcmp("m", temp) == 0) ||
+                   (strcmp("g", temp) == 0) || (strcmp("g4", temp) == 0)) {
+                       break;
+               } else {
+                       if (numnames > 0) {
+                               space -= 1;
+                               strcat(color, " ");
+                       }
+                       strncat(color, temp, space);
+                       space -= MIN(space, strlen(temp));
+                       ptr = xpm_skip_string(ptr);
+                       ptr = xpm_skip_whitespaces(ptr);
+                       numnames++;
+               }
        }
-    }
 
-    retcol = g_strdup(color);
-    return retcol;
+       retcol = g_strdup(color);
+       return retcol;
 }
 
-
 /* (almost) direct copy from gdkpixmap.c... loads an XPM from a file */
 
 static gchar *
- file_buffer(enum buf_op op, gpointer handle)
+file_buffer(enum buf_op op, gpointer handle)
 {
-    struct file_handle *h = handle;
-
-    switch (op) {
-    case op_header:
-       if (xpm_seek_string(h->infile, "XPM", FALSE) != TRUE)
-           break;
-
-       if (xpm_seek_char(h->infile, '{') != TRUE)
-           break;
-       /* Fall through to the next xpm_seek_char. */
-
-    case op_cmap:
-       xpm_seek_char(h->infile, '"');
-       fseek(h->infile, -1, SEEK_CUR);
-       /* Fall through to the xpm_read_string. */
-
-    case op_body:
-       xpm_read_string(h->infile, &h->buffer, &h->buffer_size);
-       return h->buffer;
-    }
-    return 0;
+       struct file_handle *h = handle;
+
+       switch (op) {
+       case op_header:
+               if (xpm_seek_string(h->infile, "XPM", FALSE) != TRUE)
+                       break;
+
+               if (xpm_seek_char(h->infile, '{') != TRUE)
+                       break;
+               /* Fall through to the next xpm_seek_char. */
+
+       case op_cmap:
+               xpm_seek_char(h->infile, '"');
+               fseek(h->infile, -1, SEEK_CUR);
+               /* Fall through to the xpm_read_string. */
+
+       case op_body:
+               xpm_read_string(h->infile, &h->buffer, &h->buffer_size);
+               return h->buffer;
+       }
+       return 0;
 }
 
 /* This reads from memory */
 static gchar *
- mem_buffer(enum buf_op op, gpointer handle)
+mem_buffer(enum buf_op op, gpointer handle)
 {
-    struct mem_handle *h = handle;
-    switch (op) {
-    case op_header:
-    case op_cmap:
-    case op_body:
-       if (h->data[h->offset])
-           return h->data[h->offset++];
-    }
-    return NULL;
+       struct mem_handle *h = handle;
+       switch (op) {
+       case op_header:
+       case op_cmap:
+       case op_body:
+               if (h->data[h->offset])
+                       return h->data[h->offset++];
+       }
+       return NULL;
 }
 
 /* This function does all the work. */
 
-static GdkPixBuf *
- _pixbuf_create_from_xpm(gchar * (*get_buf) (enum buf_op op, gpointer handle),
-                        gpointer handle)
+static GdkPixbuf *
+_pixbuf_create_from_xpm(gchar * (*get_buf) (enum buf_op op, gpointer handle), gpointer handle)
 {
-    gint w, h, n_col, cpp;
-    gint cnt, xcnt, ycnt, wbytes, n, ns;
-    gint is_trans = FALSE;
-    gchar *buffer, *name_buf;
-    gchar pixel_str[32];
-    GHashTable *color_hash;
-    _XPMColor *colors, *color, *fallbackcolor;
-    art_u8 *pixels, *pixtmp;
-    GdkPixBuf *pixbuf;
-    ArtPixBuf *art_pixbuf;
-
-    buffer = (*get_buf) (op_header, handle);
-    if (!buffer) {
-       g_warning("No XPM header found");
-       return NULL;
-    }
-    sscanf(buffer, "%d %d %d %d", &w, &h, &n_col, &cpp);
-    if (cpp >= 32) {
-       g_warning("XPM has more than 31 chars per pixel.");
-       return NULL;
-    }
-    /* The hash is used for fast lookups of color from chars */
-    color_hash = g_hash_table_new(g_str_hash, g_str_equal);
-
-    name_buf = g_new(gchar, n_col * (cpp + 1));
-    colors = g_new(_XPMColor, n_col);
-
-    for (cnt = 0; cnt < n_col; cnt++) {
-       gchar *color_name;
-
-       buffer = (*get_buf) (op_cmap, handle);
+       gint w, h, n_col, cpp;
+       gint cnt, xcnt, ycnt, wbytes, n, ns;
+       gint is_trans = FALSE;
+       gchar *buffer, *name_buf;
+       gchar pixel_str[32];
+       GHashTable *color_hash;
+       _XPMColor *colors, *color, *fallbackcolor;
+       art_u8 *pixels, *pixtmp;
+       GdkPixbuf *pixbuf;
+       ArtPixBuf *art_pixbuf;
+
+       buffer = (*get_buf) (op_header, handle);
        if (!buffer) {
-           g_warning("Can't load XPM colormap");
-           g_hash_table_destroy(color_hash);
-           g_free(name_buf);
-           g_free(colors);
-           return NULL;
+               g_warning("No XPM header found");
+               return NULL;
        }
-       color = &colors[cnt];
-       color->color_string = &name_buf[cnt * (cpp + 1)];
-       strncpy(color->color_string, buffer, cpp);
-       color->color_string[cpp] = 0;
-       buffer += strlen(color->color_string);
-       color->transparent = FALSE;
-
-       color_name = xpm_extract_color(buffer);
-
-       if ((color_name == NULL) || (g_strcasecmp(color_name, "None") == 0)
-           || (gdk_color_parse(color_name, &color->color) == FALSE)) {
-           color->transparent = TRUE;
-           is_trans = TRUE;
+       sscanf(buffer, "%d %d %d %d", &w, &h, &n_col, &cpp);
+       if (cpp >= 32) {
+               g_warning("XPM has more than 31 chars per pixel.");
+               return NULL;
        }
+       /* The hash is used for fast lookups of color from chars */
+       color_hash = g_hash_table_new(g_str_hash, g_str_equal);
+
+       name_buf = g_new(gchar, n_col * (cpp + 1));
+       colors = g_new(_XPMColor, n_col);
+
+       for (cnt = 0; cnt < n_col; cnt++) {
+               gchar *color_name;
+
+               buffer = (*get_buf) (op_cmap, handle);
+               if (!buffer) {
+                       g_warning("Can't load XPM colormap");
+                       g_hash_table_destroy(color_hash);
+                       g_free(name_buf);
+                       g_free(colors);
+                       return NULL;
+               }
+               color = &colors[cnt];
+               color->color_string = &name_buf[cnt * (cpp + 1)];
+               strncpy(color->color_string, buffer, cpp);
+               color->color_string[cpp] = 0;
+               buffer += strlen(color->color_string);
+               color->transparent = FALSE;
+
+               color_name = xpm_extract_color(buffer);
+
+               if ((color_name == NULL) || (g_strcasecmp(color_name, "None") == 0)
+                   || (gdk_color_parse(color_name, &color->color) == FALSE)) {
+                       color->transparent = TRUE;
+                       is_trans = TRUE;
+               }
 
-       g_free(color_name);
-       g_hash_table_insert(color_hash, color->color_string, color);
-
-       if (cnt == 0)
-           fallbackcolor = color;
-    }
+               g_free(color_name);
+               g_hash_table_insert(color_hash, color->color_string, color);
 
-    if (is_trans)
-       pixels = art_alloc(w * h * 4);
-    else
-       pixels = art_alloc(w * h * 3);
+               if (cnt == 0)
+                       fallbackcolor = color;
+       }
 
-    if (!pixels) {
-       g_warning("XPM: Cannot alloc ArtBuf");
+       if (is_trans)
+               pixels = art_alloc(w * h * 4);
+       else
+               pixels = art_alloc(w * h * 3);
+
+       if (!pixels) {
+               g_warning("XPM: Cannot alloc ArtBuf");
+               g_hash_table_destroy(color_hash);
+               g_free(colors);
+               g_free(name_buf);
+               return NULL;
+       }
+       wbytes = w * cpp;
+       pixtmp = pixels;
+
+       for (ycnt = 0; ycnt < h; ycnt++) {
+               buffer = (*get_buf) (op_body, handle);
+               if ((!buffer) || (strlen(buffer) < wbytes))
+                       continue;
+               for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) {
+                       strncpy(pixel_str, &buffer[n], cpp);
+                       pixel_str[cpp] = 0;
+                       ns = 0;
+
+                       color = g_hash_table_lookup(color_hash, pixel_str);
+
+                       /* Bad XPM...punt */
+                       if (!color)
+                               color = fallbackcolor;
+
+                       *pixtmp++ = (color->color.red)>>8;
+                       *pixtmp++ = (color->color.green)>>8;
+                       *pixtmp++ = (color->color.blue)>>8;
+
+                       if ((is_trans) && (color->transparent)) {
+                               *pixtmp++ = 0;
+                       } else if (is_trans) {
+                               *pixtmp++ = 0xFF;
+                       }
+               }
+       }
        g_hash_table_destroy(color_hash);
        g_free(colors);
        g_free(name_buf);
-       return NULL;
-    }
-    wbytes = w * cpp;
-    pixtmp = pixels;
-
-    for (ycnt = 0; ycnt < h; ycnt++) {
-       buffer = (*get_buf) (op_body, handle);
-       if ((!buffer) || (strlen(buffer) < wbytes))
-           continue;
-       for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) {
-           strncpy(pixel_str, &buffer[n], cpp);
-           pixel_str[cpp] = 0;
-           ns = 0;
-
-           color = g_hash_table_lookup(color_hash, pixel_str);
-
-           /* Bad XPM...punt */
-           if (!color)
-               color = fallbackcolor;
-
-           *pixtmp++ = (color->color.red)>>8;
-           *pixtmp++ = (color->color.green)>>8;
-           *pixtmp++ = (color->color.blue)>>8;
-
-           if ((is_trans) && (color->transparent)) {
-               *pixtmp++ = 0;
-           } else if (is_trans) {
-               *pixtmp++ = 0xFF;
-           }
-       }
-    }
-    g_hash_table_destroy(color_hash);
-    g_free(colors);
-    g_free(name_buf);
 
-    /* Ok, now stuff the GdkPixBuf with goodies */
+       /* Ok, now stuff the GdkPixbuf with goodies */
 
-    if (is_trans)
-           art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
-    else
-           art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3));
+       if (is_trans)
+               art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
+       else
+               art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3));
 
-    pixbuf = gdk_pixbuf_new (art_pixbuf, NULL);
+       pixbuf = gdk_pixbuf_new (art_pixbuf, NULL);
 
-    if (!pixbuf)
-        art_free(pixels);
+       if (!pixbuf)
+               art_free(pixels);
 
-    return pixbuf;
+       return pixbuf;
 }
 
 /* Shared library entry point for file loading */
-GdkPixBuf *image_load(FILE * f)
+GdkPixbuf *
+image_load (FILE *f)
 {
-    GdkPixBuf *pixbuf;
-    struct file_handle h;
+       GdkPixbuf *pixbuf;
+       struct file_handle h;
 
-    g_return_val_if_fail(f != NULL, NULL);
+       g_return_val_if_fail(f != NULL, NULL);
 
-    memset(&h, 0, sizeof(h));
-    h.infile = f;
-    pixbuf = _pixbuf_create_from_xpm(file_buffer, &h);
-    g_free(h.buffer);
+       memset(&h, 0, sizeof(h));
+       h.infile = f;
+       pixbuf = _pixbuf_create_from_xpm(file_buffer, &h);
+       g_free(h.buffer);
 
-    return pixbuf;
+       return pixbuf;
 }
 
 image_save()
diff --git a/gdk-pixbuf/pixbuf.h b/gdk-pixbuf/pixbuf.h
deleted file mode 100644 (file)
index 181aa06..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GDK_PIXBUF_H_
-#define _GDK_PIXBUF_H_
-
-#include <libart_lgpl/art_pixbuf.h>
-
-typedef struct {
-       int ref_count;
-       ArtPixBuf *pixbuf;
-       void (*unref_func)(void *gdkpixbuf);
-} GdkPixBuf;
-
-GdkPixBuf *gdk_pixbuf_load_image (const char *file);
-void       gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
-void       gdk_pixbuf_ref        (GdkPixBuf *pixbuf);
-void       gdk_pixbuf_unref      (GdkPixBuf *pixbuf);
-GdkPixBuf  gdk_pixbuf_duplicate  (GdkPixBuf *pixbuf);
-
-#endif /* _GDK_PIXBUF_H_ */
index aa7b9b1ed2a5d8bbeabe03d0f7b8fd28593ccbcc..73e02365bd73110628aaafb1569579d20f174a16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Creates an GdkPixBuf from a Drawable
+ * Creates an GdkPixbuf from a Drawable
  *
  * Author:
  *   Cody Russell <bratsche@dfw.net>
 
 /* private function */
 
-static GdkPixBuf *
-gdk_pixbuf_from_drawable_core (GdkWindow *window,
-                              gint x, gint y,
-                              gint width, gint height,
+static GdkPixbuf *
+gdk_pixbuf_from_drawable_core (GdkWindow *window, gint x, gint y, gint width, gint height,
                               gint with_alpha)
 {
        GdkImage *image;
@@ -41,26 +39,20 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
                                &window_width, &window_height, NULL);
        gdk_window_get_origin(window, &window_x, &window_y);
 
-       if(window_x < 0)
-       {
+       if(window_x < 0) {
                x = ABS(window_x);
                width = window_width - x;
-       }
-       else
-       {
+       } else {
                width = CLAMP(window_x + window_width, window_x,
-                               screen_width) - window_x;
+                             screen_width) - window_x;
        }
 
-       if(window_y < 0)
-       {
+       if(window_y < 0) {
                y = ABS(window_y);
                height = window_height - y;
-       }
-       else
-       {
+       } else {
                height = CLAMP(window_y + window_height, window_y,
-                               screen_height) - window_y;
+                              screen_height) - window_y;
        }
 
        image = gdk_image_get (window, x, y, width, height);
@@ -72,8 +64,7 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
        buff = art_alloc (rowstride * height);
        pixels = buff;
 
-       switch (image->depth)
-       {
+       switch (image->depth) {
        case 0:
        case 1:
        case 2:
@@ -83,10 +74,8 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
        case 6:
        case 7:
        case 8:
-               for (yy = 0; yy < height; yy++)
-               {
-                       for (xx = 0; xx < width; xx++)
-                       {
+               for (yy = 0; yy < height; yy++) {
+                       for (xx = 0; xx < width; xx++) {
                                pixel = gdk_image_get_pixel (image, xx, yy);
                                pixels[0] = colormap->colors[pixel].red;
                                pixels[1] = colormap->colors[pixel].green;
@@ -94,17 +83,15 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
                                if (with_alpha)
                                        pixels[3] = 0;
                                pixels += fatness;
-           
+
                        }
                }
                break;
 
        case 16:
        case 15:
-               for (yy = 0; yy < height; yy++)
-               {
-                       for (xx = 0; xx < width; xx++)
-                       {
+               for (yy = 0; yy < height; yy++) {
+                       for (xx = 0; xx < width; xx++) {
                                pixel = gdk_image_get_pixel (image, xx, yy);
                                r =  (pixel >> 8) & 0xf8;
                                g =  (pixel >> 3) & 0xfc;
@@ -121,10 +108,8 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
 
        case 24:
        case 32:
-               for (yy = 0; yy < height; yy++)
-               {
-                       for (xx = 0; xx < width; xx++)
-                       {
+               for (yy = 0; yy < height; yy++) {
+                       for (xx = 0; xx < width; xx++) {
                                pixel = gdk_image_get_pixel (image, xx, yy);
                                r =  (pixel >> 16) & 0xff;
                                g =  (pixel >> 8)  & 0xff;
@@ -151,18 +136,14 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
 
 /* Public functions */
 
-GdkPixBuf *
-gdk_pixbuf_rgb_from_drawable  (GdkWindow *window,
-                             gint x, gint y,
-                             gint width, gint height)
+GdkPixbuf *
+gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height)
 {
        return gdk_pixbuf_from_drawable_core  (window, x, y, width, height, 0);
 }
-          
-GdkPixBuf *
-gdk_pixbuf_rgba_from_drawable  (GdkWindow *window,
-                              gint x, gint y,
-                              gint width, gint height)
+
+GdkPixbuf *
+gdk_pixbuf_rgba_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height)
 {
        return gdk_pixbuf_from_drawable_core  (window, x, y, width, height, 1);
 }